/* $Header: cc_tbls.c,v 2.2 01/10/02 10:29:12 przybyls Exp $ */

/* cc_tbls.c - workfile get/set for cc commands */
/* Bob Cook; Oct 1993 */
/* Copyright (c) 1993, Hewlett-Packard Co. */




#include  <typedefs.h>
#include  <error.h>
#include  <stddef.h>
#include  <method.h>
#include  <config.h>
#include  <duart_ui.h>



/* definitions used with DummyFunction */
typedef UI_ERR (* const SET)(void *status, INT32 setpt, U_INT8 unused_parm);
typedef INT32  (* const GET)(void *status, U_INT8 unused_parm);


/********************* wrapper function prototypes *********************/
/*
 * Format:
 *    Get commands:
 *        mGetWrapperCommand(void *parameter, U_INT8 number)
 *    Set commands:
 *        mSetWrapperCommand(void *parameter, INT32 setpoint, U_INT8 number)
 *    Examples:
 *       parameter - pointer to oven, detector or inlet zones
 *       setpoint - value of setpoint from received command
 *       number - as ramp number
 */


static INT32  mGetHostPortBaudRate(void *parm, U_INT8 num);
static INT32  mGetHostPortParity(void *parm, U_INT8 num);
static INT32  mGetHostPortDataBits(void *parm, U_INT8 num);
static INT32  mGetHostPortStopBits(void *parm, U_INT8 num);
static INT32  mGetHostPortHandshake(void *parm, U_INT8 num);
static INT32  mGetHostPortTermSeq(void *parm, U_INT8 num);

static UI_ERR  mSetHostPortBaudRate(void *parm, INT32 setpt, U_INT8 num);
static UI_ERR  mSetHostPortParity(void *parm, INT32 setpt, U_INT8 num);
static UI_ERR  mSetHostPortDataBits(void *parm, INT32 setpt, U_INT8 num);
static UI_ERR  mSetHostPortStopBits(void *parm, INT32 setpt, U_INT8 num);
static UI_ERR  mSetHostPortHandshake(void *parm, INT32 setpt, U_INT8 num);
static UI_ERR  mSetHostPortTermSeq(void *parm, INT32 setpt, U_INT8 num);

static UI_ERR DummyFunction(void *parm);


/********************* command table entries *********************/
/*
 * Format:
 *   static const METHCMD_ENTRY mmCommandTableEntries[] =
 *   {
 *     {mGetWrapperCommand, mSetWrapperCommand, number, type of setpoint}
 *   }
 */

static const METHCMD_ENTRY mmCCCH[] =
{
      {mGetHostPortBaudRate,  mSetHostPortBaudRate,  0,METH_INT0},
      {mGetHostPortHandshake, mSetHostPortHandshake, 0,METH_INT0},
      {mGetHostPortParity,    mSetHostPortParity,    0,METH_INT0},
      {mGetHostPortDataBits,  mSetHostPortDataBits,  0,METH_INT0},
      {mGetHostPortStopBits,  mSetHostPortStopBits,  0,METH_INT0},
      {mGetHostPortTermSeq,   mSetHostPortTermSeq,   0,METH_INT0}
};


/********************* command tables *********************/
/*
 * Need on for each command.  If there are multible locations
 *    such as front/back or V1/V2/V3...V8 need one command table
 *    for each.  "paramter" is used to indicate which location.
 * Format:
 *   const METHCMD mCommandTable[] =
 *   {
 *      MAXINDEX(mmCommandTableEntries, METHCMD_ENTRY),
 *      &mmCommandTableEntries[starting_index_in_table],
 *      parameter,    --- need a pointer to a const = (void * const)
 *      PreCommandFunction,
 *      PostCommandFunction
 *   }
 */

const METHCMD mCCCH =
{
        MAXINDEX(mmCCCH, METHCMD_ENTRY),
        &mmCCCH[0],
        (void *)NULL,
        DummyFunction,
        DummyFunction
};


/********************* "get" wrapper functions *********************/

static UI_ERR DummyFunction(void *parm)
{
        (void) parm;
        return OK;
}


static INT32  mGetHostPortBaudRate(void *parm, U_INT8 num)
{
        (void) parm;
        (void) num;
        return  (INT32)GetHostPortBaudRate();
}

static INT32  mGetHostPortParity(void *parm, U_INT8 num)
{
        (void) parm;
        (void) num;
        return  (INT32)GetHostPortParity();
}


static INT32  mGetHostPortDataBits(void *parm, U_INT8 num)
{
        (void) parm;
        (void) num;
        return  (INT32)GetHostPortDataBits();
}

static INT32  mGetHostPortStopBits(void *parm, U_INT8 num)
{
        (void) parm;
        (void) num;
        return  (INT32)GetHostPortStopBits();
}

static INT32  mGetHostPortHandshake(void *parm, U_INT8 num)
{
        (void) parm;
        (void) num;
        return  (INT32)GetHostPortHandshake();
}

static INT32  mGetHostPortTermSeq(void *parm, U_INT8 num)
{
        (void) parm;
        (void) num;
        return  (INT32)GetHostPortTermSeq();
}


/********************* "set" wrapper functions *********************/

static UI_ERR  mSetHostPortBaudRate(void *parm, INT32 setpt, U_INT8 num)
{
   (void) parm;
   (void) num;
   return  SetHostPortBaudRate((BAUD_RATE_TYPE)setpt, FALSE);
}

static UI_ERR  mSetHostPortParity(void *parm, INT32 setpt, U_INT8 num)
{
   (void) parm;
   (void) num;
   return  SetHostPortParity((PARITY_TYPE)setpt, FALSE);
}

static UI_ERR  mSetHostPortDataBits(void *parm, INT32 setpt, U_INT8 num)
{
   (void) parm;
   (void) num;
   return  SetHostPortDataBits((DATA_BITS_TYPE)setpt, FALSE);
}

static UI_ERR  mSetHostPortStopBits(void *parm, INT32 setpt, U_INT8 num)
{
   (void) parm;
   (void) num;
   return  SetHostPortStopBits((STOP_BITS_TYPE)setpt, FALSE);
}

static UI_ERR  mSetHostPortHandshake(void *parm, INT32 setpt, U_INT8 num)
{
   (void) parm;
   (void) num;
   return  SetHostPortHandshake((HANDSHAKE_TYPE)setpt, FALSE);
}

static UI_ERR  mSetHostPortTermSeq(void *parm, INT32 setpt, U_INT8 num)
{
   (void) parm;
   (void) num;
   return  SetHostPortTermSeq((TERM_SEQ_TYPE)setpt, FALSE);
}


/******************* "pre" and "post" functions ********************/

